option(ENABLE_HIVE "Enable Hive" ON)

if (NOT ENABLE_HIVE)
    message("Hive disabled")
    return()
endif()

if (NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/hivemetastore")
    message(WARNING "submodule contrib/hivemetastore is missing. to fix try run: \n git submodule update --init")
    set(USE_HIVE 0)
elseif (NOT USE_HDFS)
    message(WARNING "HDFS is not found, which is needed by Hive")
    set(USE_HIVE 0)
elseif (NOT USE_PARQUET)
    message(WARNING "Parquet is not found, which are needed by Hive")
    set(USE_HIVE 0)
else()
    set(USE_HIVE 1)
    set(HIVE_METASTORE_INCLUDE_DIR ${ClickHouse_SOURCE_DIR}/contrib/hivemetastore)
    set(HIVE_METASTORE_LIBRARY hivemetastore)
endif()

message (STATUS "Using Hive=${USE_HIVE}: ${HIVE_METASTORE_INCLUDE_DIR} : ${HIVE_METASTORE_LIBRARY}")
